<template>
	<view>
		<view  v-if="role==2 || role ==3" style="background: #3464D6;display: inline-block;width: 100%;padding-bottom: 40rpx;">
			<view style="display: flex;justify-content: flex-end;margin: 20rpx;">
				<u-button  v-if="role==3" @click="go" type="primary" size="mini"
					:custom-style="{backgroundColor:'#fff',fontSize:'24rpx',color:'#2D9AFE'}" shape="circle"> 我要提现
				</u-button>
			</view>
			<view    class="u-flex u-row-around u-text-center u-margin-top-60" style="color: #fff;">
				<view>
					<view style="font-size: 40rpx;font-weight: bold;">
						￥{{menony}}
					</view>
					<view class="u-margin-top-20">余额</view>
				</view>
				<view >
					<view style="font-size: 40rpx;font-weight: bold;">
						{{user_num}}
					</view>
					<view class="u-margin-top-20">会员数量</view>
				</view>
			</view>	
		</view>


		<List :list="list"  v-if="role"></List>





		<u-loadmore :status="initial.status" />
	</view>
</template>

<script>
	import loader from '@/common/loadPage.js';

	import List from './components/storeList.vue';
	export default {
		components: {
			List
		},
		mixins: [loader],
		data() {
			return {
				nav: [{
					name: '车位'
				}, {
					name: '订单'
				}],
				current: 0,
				list: [],
				initial: {
					page: 1,
					geturl: "/api/alliance/store",
					parm: {

					},
					isPage: true
				},
				menony: "",
				user_num:'',
				role:''
				
			}
		},
		methods: {
			infomation(){
				
				return new Promise((resolve, reject) => {
				 this.$u.api.userInfo().then(res => {
					this.role = res.role;
					resolve(res)
				 }).catch(err => {
							
				 })
				})
			
			},
			
			jiazai() {
				
				this.$u.post('/api/alliance/info', {
				}).then(res => {
					this.menony = res.balance;
					this.user_num=res.userNum
				}).catch(err => {
				})
			},
			
			change(index) {
				this.current = index;
			},
			go() {
				uni.navigateTo({
					url: "../tixian/index"
				})
			}
		},
	 async	onLoad() {
			
	     await this.infomation()
			this.getGoods()
			this.jiazai()
			
		}
	}
</script>

<style>
</style>
